import { mapUrl } from "./env.js";
import request from "@/plugins/service";

// 获取验证码
export const getVerifyCode = params => {
  return request({
    url: "/api/noticeList",
    params: params
  });
};

// 密码登录
export function loginIn(data) {
  return request({
    url: "/customer/loginByUser",
    method: "post",
    data: data
  });
}

// 短信登录
export function loginByPhone(data) {
  return request({
    url: "/customer/loginByPhone",
    method: "post",
    data: data
  });
}

// 注册接口
export function register(data) {
  return request({
    url: "/customer/register",
    method: "post",
    data: data
  });
}
// 忘记密码
export function forgetPassword(data) {
  return request({
    url: "/customer/forgetPassword",
    method: "post",
    data: data
  });
}
// 发送短信
export function getsendSms(params) {
  return request({
    url: "/customer/sendSms",
    method: "get",
    params: params
  });
}
// 获取图形验证码
export function getImgCode(params) {
  return request({
    url: "/customer/getImgCode",
    method: "get",
    params: params
  });
}

export function getUser(params) {
  return request({
    url: "/user/getUser",
    method: "get",
    params: params
  });
}

//评论模块
// 发起评论
export function sendComment(data) {
  return request({
    url: "/comment/sendComment",
    method: "post",
    data: data,
    headers: { token: sessionStorage.getItem("token") }
  });
}

// 回复评论
export function replyComment(data) {
  return request({
    url: "/comment/replyComment",
    method: "post",
    data: data,
    headers: { token: sessionStorage.getItem("token") }
  });
}
//分页查询文章评论列表
export function getCommentPage(params) {
  return request({
    url: "/comment/getCommentPage",
    method: "get",
    params: params
  });
}
// 分页查询待审核评论列表
export function getAuditCommentPage(params) {
  return request({
    url: "/comment/getAuditCommentPage",
    method: "get",
    params: params
  });
}

//
//获取轮播图
export const getCarousel = data => {
  return request({
    method: "post",
    url: "/carouse/getCarousel",
    data
  });
};
//根据id获取轮播图数据
export const getNoticeList = data => {
  return request({
    method: "post",
    url: "/carouse/getNoticeList",
    data
  });
};
//const getNoticeList = p => axios.fetchPost('/carouse/getNoticeList', p)  //获取文章标题
//获取热线工作数据
export const hotworkData = data => {
  return request({
    method: "post",
    url: "/notice/pageQuery",
    data
  });
};
//根据id查详情
export const queryById = data => {
  return request({
    method: "post",
    url: "/notice/queryById",
    data
  });
};
//const queryById = p => axios.fetchPost('/notice/queryById', p)  //查询页面列表数据
//获取通知公告数据

export const publicNotic = data => {
  return request({
    method: "post",
    url: "/notice/pageQuery",
    data
  });
};

export const queryByBizType = data => {
  return request({
    method: "post",
    url: "/notice/queryByBizType",
    data
  });
};

export const addOrder = data => {
  return request({
    method: "post",
    url: "/orderFlowMedia/add",
    data
  });
};

export const queryOrder = data => {
  return request({
    method: "post",
    url: "orderFlowMedia/select_order_progress",
    data
  });
};

// export const queryByBizType = (data) => {
//     return request({
//         method: 'post',
//         url: '/notice/queryByBizType',
//         data
//     })
// }

export const queryFlowTelephone = data => {
  return request({
    method: "post",
    url: "/orderFlowTelephone/getFollowOrderByIdWeXin",
    data
  });
};

export const queryMapData = data => {
  return request({
    method: "post",
    url: mapUrl + "/dataReport/getRegionChannelByTime",
    data
  });
};

// 查询是否需要开启维护界面
export const getSystemMaintain = params => {
  return request({
    method: "GET",
    url: "/maintain/getSystemMaintain",
    params
  });
};
